Add GuestOS
|
Do as below if you would like to add new GuestOS. Following example shows a GuestOS named 'mail' is newly added. |
[1] | Create new partition to install new GuestOS first. |
# create a logical volume 'mail00' in volume group 'Xen' [root@ns ~]# lvcreate -L 5G -n mail00 Xen Logical volume "mail00" created [root@ns ~]# # create new logical volumes for mount points you create [root@ns ~]# lvcreate -L 1G -n mail01 Xen Logical volume "mail01" created [root@ns ~]# lvcreate -L 5G -n mail02 Xen Logical volume "mail02" created [root@ns ~]# lvcreate -L 7G -n mail03 Xen Logical volume "mail03" created [root@ns ~]# lvcreate -L 1G -n mail04 Xen Logical volume "mail04" created [root@ns ~]# [root@ns ~]# mkfs -t ext3 /dev/Xen/mail00 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 655360 inodes, 1310720 blocks 65536 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@ns ~]# mkswap /dev/Xen/mail01 Setting up swapspace version 1, size = 1073737 kB [root@ns ~]# mkfs -t ext3 /dev/Xen/mail02 [root@ns ~]# mkfs -t ext3 /dev/Xen/mail03 [root@ns ~]# mkfs -t ext3 /dev/Xen/mail04 [root@ns ~]# [root@ns ~]# mount /dev/Xen/mail03 /mnt [root@ns ~]# cp var.tgz /mnt/ # copy it created in (3)-[3] [root@ns ~]# cd /mnt [root@ns mnt]# tar zxvf var.tgz [root@ns mnt]# rm -f var.tgz [root@ns mnt]# [root@ns ~]# umount /mnt [root@ns ~]# [root@ns ~]# mount /dev/Xen/mail02 /mnt [root@ns ~]# cp usr.tgz /mnt/ # copy it created in (3)-[3] [root@ns ~]# cd /mnt [root@ns mnt]# tar zxvf usr.tgz [root@ns mnt]# rm -f usr.tgz [root@ns mnt]# [root@ns ~]# umount /mnt [root@ns ~]# [root@ns ~]# mount /dev/Xen/mail00 /mnt [root@ns ~]# cp root.tgz /mnt/ # copy it created in (3)-[3] [root@ns ~]# cd /mnt [root@ns mnt]# tar zxvf root.tgz [root@ns mnt]# rm -f root.tgz [root@ns mnt]# vi etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME= mail .server-linux.info# change hostname GATEWAY=192.168.0.1 [root@ns mnt]# vi etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static BROADCAST=192.168.0.255 #HWADDR=00:13:72:0F:00:80 IPADDR=192.168.0. 19 # change IP address IPV6ADDR= IPV6PREFIX= NETMASK=255.255.255.0 NETWORK=192.168.0.0 ONBOOT=yes [root@ns mnt]# vi etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 mail .server-linux.info mail localhost.localdomain localhost::1 localhost6.localdomain6 localhost6 [root@ns mnt]# [root@ns ~]# umount /mnt [root@ns ~]# cp /etc/xen/www /etc/xen/mail [root@ns ~]# vi /etc/xen/mail # change like below kernel = "/boot/vmlinuz-2.6.18-8.1.1.el5xen" ramdisk = "/boot/initrd-2.6.18-8.1.1.el5xen.img" memory = "512" name = " mail "vcpus = "2" nicks = "1" vif = [ 'mac=00:16:3e:00:00:1 2 ,bridge=xenbr0' ]disk = [ 'phy:Xen/ mail 00,hda1,w','phy:Xen/ mail 01,hda2,w','phy:Xen/ mail 02,hda3,w','phy:Xen/ mail 03,hda4,w','phy:Xen/ mail 04,hda5,w' ]root = "/dev/hda1 ro" extra = "3" [root@ns ~]# xm create -c mail mail.server-linux.info login: # change permission of /tmp [root@mail ~]# chmod 1777 /tmp
|